Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 3 - Endpoints / Endpoints Reference
Functions / Establishing A Connection


OTListen

Listens for an incoming connection request.

C INTERFACE
OSStatus OTListen(EndpointRef ref, TCall* call);
C++ INTERFACE
OSStatus TEndpoint::Listen(TCall* call);
PARAMETERS
ref
The endpoint reference of the endpoint listening for the connection request.
call
A pointer to a TCall structure (page 3-62) that contains information about the address of the peer requesting the connection, option information, data associated with the connection request, and the connection ID for this connection.
DESCRIPTION
You use the OTListen function to listen for incoming connection requests. On return, the function fills in the TCall structure referenced by the call parameter with information about the connection request. After retrieving the connection request using the OTListen function, you can reject the request using the OTSndDisconnect function, or you can accept the request using the OTAccept function.

If the endpoint is in synchronous mode and is blocking, the OTListen function returns when a connection request has arrived. If the endpoint is in asynchronous mode or is not blocking, the OTListen function returns any pending connection requests or returns the kOTNoDataErr result if there are
no pending connection requests. You can also call the OTListen function from within a notifier function in response to the T_LISTEN event. In this case, the function returns a result immediately.

SPECIAL CONSIDERATIONS
Not all endpoints support the sending of data with a connection request. Examine the connect field of the TendpointInfo structure for the endpoint to determine if the endpoint supports the sending of data and to determine the maximum size of the data.

To ensure portability, do not explicitly bind the endpoint to which you are passing off a connection if its address is to be the same as that of the endpoint listening for connection requests.

VALID STATES
T_IDLE, T_INCON

SEE ALSO
You use the OTAccept function (described next) to read an incoming connection request that you have retrieved using the OTListen function.

You use the TCall structure (page 3-62) to store information about the address of the peer requesting the connection, option information, data associated with the connection request, and the connection ID for this connection.

You use the OTSndDisconnect function (page 3-149) to reject a connection request.

You specify the maximum number of outstanding connections for an endpoint when you bind the endpoint using the OTBind function (page 3-77).

For information on how to use this function with a TCP/IP protocol, see page 8-18 in the TCP/IP chapter.

For information on how to use this function with AppleTalk protocols, see page 13-11 in the ADSP chapter and page 15-10 in the PAP chapter.

You examine the connect field of the TEndpointInfo structure (page 3-48) to determine whether your endpoint supports the sending of data with a connection request.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996